package com.smart.mapper;

import com.smart.pojo.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smart.resp.EchartsData;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author lyj
 * @since 2023-05-13
 */
public interface ProductMapper extends BaseMapper<Product> {

    @Select("select *\n" +
            "from product\n" +
            "where id not in\n" +
            "(select product_id \n" +
            "from produce\n" +
            "where del_flag=0)\n" +
            "and del_flag=0")
    List<Product> queryNotProducePlan();

    @Select("select name,ifnull(num,0) value\n" +
            "from product\n" +
            "where del_flag=0")
    List<EchartsData> getInventoryData();
}
